package com.atguigu.algorithm;

import java.util.Scanner;
/*
ac
cz
 */
public class TheCountOfString {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNextLine()){
            StringBuilder sb1=new StringBuilder(scanner.next());
            StringBuilder sb2=new StringBuilder(scanner.next());
            int len1=scanner.nextInt();
            int len2=scanner.nextInt();
            //将s1和s2进行扩充到同样大小
            for(int i=sb1.length();i<len2;i++){
                sb1.append('a');
            }
            for(int i=sb2.length();i<len2;i++){
                sb2.append('z'+1);
            }
            int[] array=new int[len2];
            for(int i=0;i<len2;i++){
                array[i]=sb2.charAt(i)-sb1.charAt(i);
            }
            long result=0; //计算结果
            for(int i=len1;i<=len2;i++){
                for(int j=0;j<i;j++){
                    result+=array[j]*Math.pow(26,i-j-1);
                }
            }
            System.out.println((result-1)%1000007);
        }
    }
}
